<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 20px;
        background-color: #f0f0f0;
    }

    .grid-container {
        display: grid;
        gap: 20px;
        padding: 20px;
        max-width: 1200px;
        margin: 0 auto;
    }

    .grid-item {
        background-color: white;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease;
        aspect-ratio: 1 / 1;
        display: flex;
        flex-direction: column;
        padding: 10px;
    }

    .grid-item:hover {
        transform: translateY(-5px);
    }

    .grid-item img {
        width: 100%;
        height: 75%;
        object-fit: contain;
    }

    .grid-item p {
        margin: 5px 0;
        padding: 0;
        text-align: center;
        font-weight: bold;
        flex-shrink: 0;
    }

    .tips-container {
        background-color: #fff3cd;
        border: 1px solid #ffeeba;
        border-radius: 8px;
        padding: 15px;
        margin: 0 auto 20px;
        max-width: 1200px;
        color: #856404;
    }

    .tips-container h3 {
        margin: 0 0 10px 0;
        color: #856404;
    }

    .tips-container ul {
        margin: 0;
        padding-left: 20px;
    }

    .tips-container li {
        margin: 5px 0;
    }
</style>

<body>
    <div class="tips-container">
        <h3>📌 说明</h3>
        <ul>
            <li>此页面展示了光遇所有的季节(上线正式服为准)</li>
            <li>可用: "{季节名称}兑换图"来查看指定季节的兑换图</li>
            <li>可用: "{季节名称}多久未复刻"来查看指定季节的先祖有多久未复刻</li>
        </ul>
    </div>

    <div id="grid-container" class="grid-container"></div>

    <script>
        const images = JSON.parse('{{@images}}')

        const placeholderImage = 'https://gitee.com/Tloml-Starry/resources/raw/master/resources/img/example/placeholder.svg';

        function handleImageError(img) {
            img.onerror = null;
            img.src = placeholderImage;
        }

        function createGrid(images) {
            const container = document.getElementById('grid-container');
            const gridSize = Math.ceil(Math.sqrt(images.length));

            container.style.gridTemplateColumns = `repeat(${gridSize}, 1fr)`;

            images.forEach(image => {
                const item = document.createElement('div');
                item.className = 'grid-item';
                item.innerHTML = `
                    <img src="${image.src}" alt="${image.name}">
                    <p>${image.name}</p>
                `;
                container.appendChild(item);
            });
        }

        createGrid(images);
    </script>
</body>